package com.cal.utms.action.maintenance;

import com.cal.utms.dto.maintenance.SystemConfigurationDto;
import com.cal.utms.model.maintenance.ConfigurationModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class SystemConfigurationAction extends ActionSupport implements ModelDriven<SystemConfigurationDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private SystemConfigurationDto configurationDto = new SystemConfigurationDto();
	ConfigurationModel configurationModel = new ConfigurationModel();
	private String compemails;

	public String saveConfiguration() {
		configurationModel.save(configurationDto, compemails);
		return Action.SUCCESS;
	}

	public String getConfiguration() {
		configurationDto.setConfigurationDtos(configurationModel.getConfiguration());
		configurationDto.setEmails(configurationModel.getEmail());
		return Action.SUCCESS;
	}

	@Override
	public SystemConfigurationDto getModel() {
		return configurationDto;
	}

	public SystemConfigurationDto getConfigurationDto() {
		return configurationDto;
	}

	public void setConfigurationDto(SystemConfigurationDto configurationDto) {
		this.configurationDto = configurationDto;
	}

	public String getCompemails() {
		return compemails;
	}

	public void setCompemails(String compemails) {
		this.compemails = compemails;
	}

}
